import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalRef } from 'ng-zorro-antd/modal';


@Component({
  selector: 'app-business-items-indicate-view',
  templateUrl: './view.component.html'
})
export class BusinessItemsIndicateViewComponent implements OnInit {
  record: any = {};
  i: any;

  constructor(private modal: NzModalRef, private msgSrv: NzMessageService, private http: _HttpClient, private cdr: ChangeDetectorRef) {}

  ngOnInit(): void {
    // zip(
    //   this.http.get(`api/order/overview`, { orderSn: orderSn }),
    //   this.http.get(`api/order/item_overview`, { orderSn: orderSn }),
    //   this.http.get(`api/order/item_current`, { orderSn: orderSn })
    // )
    //   .pipe(
    //     finalize(() => {
    //       this.cdr.detectChanges();
    //     })
    //   )
    //   .subscribe(([overview, itemOverview, itemCurrent]: [NzSafeAny, NzSafeAny, NzSafeAny]) => {
    //     this.i = true;
    //     this.overview = overview.data;
    //     this.deadline = moment(overview.data['paymentAt']).add(7, 'days');
    //     // 订单明细优惠逻辑
    //     for (let j = 0; j < itemOverview.data['skus'].length; j++) {
    //       let quantityFeeInfoList = itemOverview.data['skus'][j]['quantityFeeInfoList'];
    //       let settlePrice = itemOverview.data['skus'][j]['finalPrice'];
    //       for (let k = 0; k < quantityFeeInfoList.length; k++) {
    //         let quantityFeeInfo = quantityFeeInfoList[k];
    //         console.log(settlePrice, quantityFeeInfo['frees']);
    //         settlePrice += quantityFeeInfo['frees'];
    //       }
    //
    //       itemOverview.data['skus'][j]['settlePrice'] = settlePrice;
    //     }
    //     this.itemOverview = itemOverview.data;
    //     this.itemCurrent = itemCurrent.data;
    //   });
  }

  close(): void {
    this.modal.destroy();
  }
}
